﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<SDT.Site.ViewModels.DemandSearchModels>" %>
<%@ Import Namespace="SDT.Model" %>
<%@ Import Namespace="SDT.Site.ViewModels" %>
<div class="bor_cor mar_t">
    <div class="bar_blue" style="text-align:center">Theo tỉnh thành</div>
    <div class="tinrao_cate">
        <ul>
        <% if (Model.Cities != null && Model.Cities.Count() > 0)
           {
               int count = 0;
               foreach (var c in Model.Cities)
               {
                   var path = string.Format("/demand/index/{0}/{1}/{2}/{3}/{4}/{5}/{6}/{7}",
                       Model.TypeID.HasValue ? Model.TypeID.Value : 0,
                       Model.CategoryID.HasValue? Model.CategoryID.Value:0,
                       c.ID,
                       Model.DistrictID.HasValue ? Model.DistrictID.Value : 0,
                       Model.AreaID.HasValue ? Model.AreaID.Value : 0,
                       Model.PriceID.HasValue ? Model.PriceID.Value : 0,
                       Model.ProjectID.HasValue ? Model.ProjectID.Value : 0,
                       Model.TimeID.HasValue ? Model.TimeID.Value : 0);
                   var css = c.ID == Model.CityID ? "act" : string.Empty;
                   
                   count++;
                   var cssli = count > 10 ? "sub hide" : string.Empty;
            %>
            <li class="<%=cssli %>">
                <a href="<%=path %>" class="<%=css %>"><%=Html.Encode(c.Name) %></a>
            </li>
            <%}%>
            <li class="sub" id="show-all"><a title="tất cả" href="javascript:ShowCityLink(1);"> Tất cả [ <font style="color:#f87310;float:none;">+</font> ]</a></li>
            <li class="sub hide" id="hide-all"><a title="thu gọn" href="javascript:ShowCityLink(0);"> Thu gọn [ <font style="color:#f87310;float:none;">-</font> ]</a></li>
        <%}%>
        </ul>   
    </div>
    <div class="clear"></div>
</div>
<div class="clear"></div>
<script type="text/javascript">   
    function ShowCityLink(showid) {
        if (showid == 1) {
            $(".sub").removeClass("hide");
            $("#show-all").addClass("hide");
        } else {
            $(".sub").addClass("hide");
            $("#show-all").removeClass("hide");
        }
    } 
</script>

